package com.xiaoshuidi.cloud.module.system.controller.admin.permission.vo.menu;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 菜单 Base VO，提供给添加、修改、详细的子 VO 使用
 * 如果子 VO 存在差异的字段，请不要添加到这里，影响 Swagger 文档生成
 */
@Data
public class MenuBaseVO {

    /**
     * 菜单名称
     */
    @Schema(description = "菜单名称", required = true, example = "合房")
    @NotBlank(message = "菜单名称不能为空")
    @Size(max = 50, message = "菜单名称长度不能超过50个字符")
    private String name;

    /**
     * 权限标识,仅菜单类型为按钮时，才需要传递
     */
    @Schema(description = "权限标识,仅菜单类型为按钮时，才需要传递", example = "sys:menu:add")
    @Size(max = 100)
    private String permission;

    /**
     * 类型,参见 MenuTypeEnum 枚举类
     */
    @Schema(description = "类型,参见 MenuTypeEnum 枚举类", required = true, example = "1")
    @NotNull(message = "菜单类型不能为空")
    private Integer type;

    /**
     * 显示顺序不能为空
     */
    @Schema(description = "显示顺序不能为空", required = true, example = "1024")
    @NotNull(message = "显示顺序不能为空")
    private Integer sort;

    /**
     * 父菜单 ID
     */
    @Schema(description = "父菜单 ID", required = true, example = "1024")
    @NotNull(message = "父菜单 ID 不能为空")
    private Long parentId;

    /**
     * 路由地址,仅菜单类型为菜单或者目录时，才需要传
     */
    @Schema(description = "路由地址,仅菜单类型为菜单或者目录时，才需要传", example = "post")
    @Size(max = 200, message = "路由地址不能超过200个字符")
    private String path;

    /**
     * 菜单图标,仅菜单类型为菜单或者目录时，才需要传
     */
    @Schema(description = "菜单图标,仅菜单类型为菜单或者目录时，才需要传", example = "/menu/list")
    private String icon;

    /**
     * 组件路径,仅菜单类型为菜单时，才需要传
     */
    @Schema(description = "组件路径,仅菜单类型为菜单时，才需要传", example = "system/post/index")
    @Size(max = 200, message = "组件路径不能超过255个字符")
    private String component;

    /**
     * 组件名
     */
    @Schema(description = "组件名", example = "SystemUser")
    private String componentName;

    /**
     * 状态,见 CommonStatusEnum 枚举
     */
    @Schema(description = "状态,见 CommonStatusEnum 枚举", required = true, example = "1")
    @NotNull(message = "状态不能为空")
    private Integer status;

    /**
     * 是否可见
     */
    @Schema(description = "是否可见", example = "false")
    private Boolean visible;

    /**
     * 是否缓存
     */
    @Schema(description = "是否缓存", example = "false")
    private Boolean keepAlive;

    /**
     * 是否总是显示
     */
    @Schema(description = "是否总是显示", example = "false")
    private Boolean alwaysShow;

}
